{{define "form/realitySettings"}}
<template>
    <a-form-item label='Show'>
        <a-switch v-model="inbound.stream.reality.show"></a-switch>
    </a-form-item>
    <a-form-item label='Xver'>
        <a-input-number v-model.number="inbound.stream.reality.xver" :min="0"></a-input-number>
    </a-form-item>
    <a-form-item label='uTLS'>
        <a-select v-model="inbound.stream.reality.settings.fingerprint" :style="{ width: '100%' }"
            :dropdown-class-name="themeSwitcher.currentTheme">
            <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
        </a-select>
    </a-form-item>
    <a-form-item label='Dest (Target)'>
        <a-input v-model.trim="inbound.stream.reality.dest"></a-input>
    </a-form-item>
    <a-form-item label='SNI'>
        <a-input v-model.trim="inbound.stream.reality.serverNames"></a-input>
    </a-form-item>

    <!-- CDN回落限速 -->
    <a-collapse>
        <a-collapse-panel>
            <template slot="header">
                CDN回落限速<a-icon type="security-scan"></a-icon>
                <a-tooltip>
                    <template slot="title">
                        <div>
                            <div>对未通过验证的回落连接限速，针对CDN偷跑流量做限制。
                                <a href="https://github.com/XTLS/REALITY"  target="_blank"
                                   style="color: #1890ff; text-decoration: underline;">Reality</a>
                                <a href="https://github.com/XTLS/Xray-core/pull/4553"  target="_blank"
                                   style="color: #1890ff; text-decoration: underline;">CDN回落限速</a>
                            </div>
                        </div>
                    </template>
                    <a-icon type="question-circle" style="margin-left: 8px;"></a-icon>
                </a-tooltip>
            </template>
            <a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
                <a-form-item>
                    <span slot="label">
                        启用限速
                        <a-tooltip>
                            <template slot="title">
                                <span>启用后可对上传和下载分别设置限速参数</span>
                            </template>
                            <a-icon type="question-circle"></a-icon>
                        </a-tooltip>
                    </span>
                    <a-switch v-model="inbound.stream.reality.limitFallbackEnabled"></a-switch>
                </a-form-item>
                <template v-if="inbound.stream.reality.limitFallbackEnabled">
                    <a-divider :style="{ margin: '0' }"> 上传限速 <a-icon type="cloud-upload"></a-icon></a-divider>
                    <a-form-item label="传输字节后开始限速">
                        <a-input-group compact>
                            <a-input-number v-model.number="inbound.stream.reality.limitFallbackUpload._afterBytesDisplay"
                                :min="0" :precision="0" placeholder="0" style="width: 70%"></a-input-number>
                            <a-select v-model="inbound.stream.reality.limitFallbackUpload._afterBytesUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                <a-select-option value="B">B</a-select-option>
                                <a-select-option value="KB">KB</a-select-option>
                                <a-select-option value="MB">MB</a-select-option>
                            </a-select>
                        </a-input-group>
                    </a-form-item>
                    <a-form-item label="基准速率">
                        <a-input-group compact>
                            <a-input-number v-model.number="inbound.stream.reality.limitFallbackUpload._bytesPerSecDisplay"
                                :min="1" :precision="0" placeholder="1" style="width: 70%"></a-input-number>
                            <a-select v-model="inbound.stream.reality.limitFallbackUpload._bytesPerSecUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                <a-select-option value="B/s">B/s</a-select-option>
                                <a-select-option value="KB/s">KB/s</a-select-option>
                                <a-select-option value="MB/s">MB/s</a-select-option>
                            </a-select>
                        </a-input-group>
                    </a-form-item>
                    <a-form-item label="突发速率">
                        <a-input-group compact>
                            <a-input-number v-model.number="inbound.stream.reality.limitFallbackUpload._burstBytesPerSecDisplay"
                                :min="1" :precision="0" placeholder="1" style="width: 70%"></a-input-number>
                            <a-select v-model="inbound.stream.reality.limitFallbackUpload._burstBytesPerSecUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                <a-select-option value="B/s">B/s</a-select-option>
                                <a-select-option value="KB/s">KB/s</a-select-option>
                                <a-select-option value="MB/s">MB/s</a-select-option>
                            </a-select>
                        </a-input-group>
                    </a-form-item>
                    <a-divider :style="{ margin: '0' }"> 下载限速 <a-icon type="cloud-download"></a-icon></a-divider>
                        <a-form-item label="传输字节后开始限速">
                            <a-input-group compact>
                                <a-input-number v-model.number="inbound.stream.reality.limitFallbackDownload._afterBytesDisplay"
                                    :min="0" :precision="0" placeholder="0" style="width: 70%"></a-input-number>
                                <a-select v-model="inbound.stream.reality.limitFallbackDownload._afterBytesUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                    <a-select-option value="B">B</a-select-option>
                                    <a-select-option value="KB">KB</a-select-option>
                                    <a-select-option value="MB">MB</a-select-option>
                                </a-select>
                            </a-input-group>
                        </a-form-item>
                        <a-form-item label="基准速率">
                            <a-input-group compact>
                                <a-input-number v-model.number="inbound.stream.reality.limitFallbackDownload._bytesPerSecDisplay"
                                    :min="1" :precision="0" placeholder="1" style="width: 70%"></a-input-number>
                                <a-select v-model="inbound.stream.reality.limitFallbackDownload._bytesPerSecUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                    <a-select-option value="B/s">B/s</a-select-option>
                                    <a-select-option value="KB/s">KB/s</a-select-option>
                                    <a-select-option value="MB/s">MB/s</a-select-option>
                                </a-select>
                            </a-input-group>
                        </a-form-item>
                        <a-form-item label="突发速率">
                            <a-input-group compact>
                                <a-input-number v-model.number="inbound.stream.reality.limitFallbackDownload._burstBytesPerSecDisplay"
                                    :min="1" :precision="0" placeholder="1" style="width: 70%"></a-input-number>
                                <a-select v-model="inbound.stream.reality.limitFallbackDownload._burstBytesPerSecUnit" style="width: 30%" :dropdown-class-name="themeSwitcher.currentTheme">
                                    <a-select-option value="B/s">B/s</a-select-option>
                                    <a-select-option value="KB/s">KB/s</a-select-option>
                                    <a-select-option value="MB/s">MB/s</a-select-option>
                                </a-select>
                            </a-input-group>
                        </a-form-item>
                </template>
            </a-form>
        </a-collapse-panel>
    </a-collapse>
    <a-form-item label='Max Time Diff (ms)'>
        <a-input-number v-model.number="inbound.stream.reality.maxTimediff" :min="0"></a-input-number>
    </a-form-item>
    <a-form-item label='Min Client Ver'>
        <a-input v-model.trim="inbound.stream.reality.minClientVer"></a-input>
    </a-form-item>
    <a-form-item label='Max Client Ver'>
        <a-input v-model.trim="inbound.stream.reality.maxClientVer"></a-input>
    </a-form-item>
    <a-form-item>
        <template slot="label">
            <a-tooltip>
                <template slot="title">
                    <span>{{ i18n "reset" }}</span>
                </template> Short IDs <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortIds()"
                    type="sync"></a-icon>
            </a-tooltip>
        </template>
        <a-input v-model.trim="inbound.stream.reality.shortIds"></a-input>
    </a-form-item>
    <a-form-item label='SpiderX'>
        <a-input v-model.trim="inbound.stream.reality.settings.spiderX"></a-input>
    </a-form-item>
    <a-form-item label='{{ i18n "pages.inbounds.publicKey" }}'>
        <a-input v-model="inbound.stream.reality.settings.publicKey"></a-input>
    </a-form-item>
    <a-form-item label='{{ i18n "pages.inbounds.privatekey" }}'>
        <a-input v-model="inbound.stream.reality.privateKey"></a-input>
    </a-form-item>
    <a-form-item label=" ">
        <a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Cert</a-button>
    </a-form-item>
    <a-form-item label="mldsa65 Seed">
        <a-input v-model="inbound.stream.reality.mldsa65Seed"></a-input>
    </a-form-item>
    <a-form-item label="mldsa65 Verify">
        <a-textarea v-model="inbound.stream.reality.settings.mldsa65Verify"></a-textarea>
    </a-form-item>
    <a-form-item label=" ">
        <a-button type="primary" icon="import" @click="getNewmldsa65">Get New Seed</a-button>
    </a-form-item>
</template>
{{end}}